package com.example.nfctagcommons.controllers;

import android.app.Activity;

import com.example.nfctagcommons.exceptions.ConnectivityException;
import com.example.nfctagcommons.server.HttpsExecuter;
import com.example.nfctagcommons.server.ServerInfo;

public class SystemController {
	public static long synchronizeTime(Activity activity) throws ConnectivityException{
		String completeURL = ServerInfo.SERVER_HOST+ServerInfo.SERVICES_PATH;
		String query = "operation=getTime";
		String response = HttpsExecuter.execute(activity, completeURL, query, true);
		try{
	        return Long.valueOf(response.replace("\n", ""))*1000;
        }catch (Exception x){
        	x.printStackTrace();
        	return 0;
        }
	}
}
